package com.cxx.purchasecharge.core.model.persistence;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.cxx.purchasecharge.core.model.BaseModel;
import com.cxx.purchasecharge.core.model.GoodsIssueStatusCode;

/**
 * 问题货物
 * 
 * @author xiang
 * 
 */
@Entity
@Table (name = "pc_goods_issue")
public class GoodsIssue extends BaseModel
{
    private static final long serialVersionUID = 1L;

    private long id;

    /**
     * 具体的某一个问题商品的序列号
     */
    private String serialNumber;
    /**
     * 某一类商品的编号
     */
    private long goods;
    /**
     * 描述
     */
    private String description;
    private GoodsIssueStatusCode statusCode = GoodsIssueStatusCode.NEW;
    /**
     * 提出返修的客户
     */
    private long customer;
    /**
     * 谁负责处理
     */
    private long signUser;
    private long userCreatedBy;
    private long userUpdatedBy;
    /**
     * 何时销售出去的
     */
    private Date created;
    /**
     * 最后一次更新的时间
     */
    private Date updated;

    private List <GoodsIssueComment> issueComments;
    
    public GoodsIssue () {}

    @Id
    @GeneratedValue (strategy = GenerationType.AUTO)
    public long getId ()
    {
        return id;
    }

    public void setId (long id)
    {
        this.id = id;
    }

    @Column (nullable = false, unique = true)
    public String getSerialNumber ()
    {
        return serialNumber;
    }

    public void setSerialNumber (String serialNumber)
    {
        this.serialNumber = serialNumber;
    }

    @Column (nullable = false)
    public long getGoods ()
    {
        return goods;
    }

    public void setGoods (long goods)
    {
        this.goods = goods;
    }

    @Column (nullable = false, length = 2048)
    public String getDescription ()
    {
        return description;
    }

    public void setDescription (String description)
    {
        this.description = description;
    }

    public GoodsIssueStatusCode getStatusCode ()
    {
        return statusCode;
    }

    public void setStatusCode (GoodsIssueStatusCode statusCode)
    {
        this.statusCode = statusCode;
    }

    @Column (nullable = false)
    public long getCustomer ()
    {
        return customer;
    }

    public void setCustomer (long customer)
    {
        this.customer = customer;
    }

    public long getSignUser ()
    {
        return signUser;
    }

    public void setSignUser (long signUser)
    {
        this.signUser = signUser;
    }

    public long getUserCreatedBy()
    {
        return userCreatedBy;
    }

    public void setUserCreatedBy(long userCreatedBy)
    {
        this.userCreatedBy = userCreatedBy;
    }

    public long getUserUpdatedBy()
    {
        return userUpdatedBy;
    }

    public void setUserUpdatedBy(long userUpdatedBy)
    {
        this.userUpdatedBy = userUpdatedBy;
    }

    @Column (nullable = false)
    public Date getCreated ()
    {
        return created;
    }

    public void setCreated (Date created)
    {
        this.created = created;
    }

    @Column (nullable = false)
    public Date getUpdated ()
    {
        return updated;
    }

    public void setUpdated (Date updated)
    {
        this.updated = updated;
    }

    @OneToMany (mappedBy = "issue")
    public List <GoodsIssueComment> getIssueComments ()
    {
        return issueComments;
    }

    public void setIssueComments (List <GoodsIssueComment> issueComments)
    {
        this.issueComments = issueComments;
    }

}
